package com.zy.studentSide.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zy.studentSide.entity.StudentTask;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author 29787
 */
@Mapper
@Component
public interface StudentTaskDao extends BaseMapper<StudentTask> {

    /**
     * 查询是否已提交作业
     * @param classroomId
     * @param studentId
     * @param taskId
     * @param teacherId
     * @param courseId
     * @return StudentTask
     */
    @Select("select * from hms_student_task where classroom_id=#{classroomId} and student_id=#{studentId} and task_id=#{taskId} and teacher_id=#{teacherId} and course_id=#{courseId}")
    StudentTask getStudentTask(Integer classroomId,Integer studentId,Integer taskId,Integer teacherId,Integer courseId);

    /**
     * 查询作业信息
     * @param classroomId
     * @param taskId
     * @param teacherId
     * @param courseId
     * @return List<StudentTask>
     */
    @Select("select * from hms_student_task where classroom_id=#{classroomId} and task_id=#{taskId} and teacher_id=#{teacherId} and course_id=#{courseId}")
    List<StudentTask> getStudentTaskById(Integer classroomId, Integer taskId, Integer teacherId, Integer courseId);

}
